﻿@model Orion.Models.HomeIndexViewModel
           
<script src="@Url.Content("~/Scripts/Pagination/jquery.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/Pagination/jquery.pagination.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/Pagination/jquery.pag.js")" type="text/javascript"></script>


@{
    ViewBag.Title = "IRIS Innranet - Mínar greinar";
    Layout = "~/Views/Shared/_WorkLayout.cshtml";
}

<section id="main_content">
<h1>Mínar greinar</h1>


        <div id="Searchresult"></div>
        
        @{
            var sk = 0;
            for (int m = 0; m < Model.counter; m++)
            {
            <div id="hiddenresult" style="display:none;">
                <div class="result">
                    <table>
                    <thead>
                        <tr>
                            <th>Númer</th>
                            <th>Dagsetning</th>
                            <th>Titill</th>
                            <th>Flokkur</th>
                            <th></th>
                            <th></th>
                        </tr>
                    </thead>
                        <tbody>
                                             
                        @foreach( var n in Model.NewsArticle.Skip(sk).Take( Model.displayNewsArticle ) )
                        {
                           DateTime temp = n.ContentDate;
                            <tr>
                                <td class="id">@n.ID</td>
                                <td class="date">@temp.ToString("dd MMMM yyyy")</td>
                                <td class="NewsArticleTitle">@Html.ActionLink(n.Title, "GetNewsArticleById/" + @n.ID, "WorkNewsArticle")</td>
                                <td class="action">@n.ContentType</td>
                                <td class="action">@Html.ActionLink("Breyta", "EditNewsArticle/" + @n.ID, "WorkNewsArticle")</td>
                                @if (n.Valid == true)
                                {
                                    <td class="action">@Html.ActionLink("Eyða", "DisableNewsArticle/" + @n.ID, "WorkNewsArticle", new { onclick = "return confirm('Ertu viss um að þú viljir eyða greininni?')" })</td>
                                }
                                else
                                {
                                    <td class="action">@Html.ActionLink("Birta", "EnableNewsArticle/" + @n.ID, "WorkNewsArticle", new { onclick = "return confirm('Ertu viss um að þú viljir birta greinina?')" })</td>
                                }
                            </tr>
                        }
                        </tbody>
                    </table>
                </div>
            </div>
            sk = sk + Model.displayNewsArticle;
            }
        }    <div id="Pagination"></div>

</section>